//
//  NSDictionary+Property.m
//  自动生成属性代码
//
//  Created by 罗壮燊 on 15/12/27.
//  Copyright © 2015年 lzs. All rights reserved.
//

#import "NSDictionary+Property.h"

#import <objc/message.h>

@implementation NSDictionary (Property)


- (void)printPropertys
{
    NSMutableString *strM = [NSMutableString string];
    [self enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) {
       
        if ([obj isKindOfClass:[NSString class]]) {
            [strM appendFormat:@"\n@property (nonatomic, strong) NSString *%@;\n", key];
        } else if ([obj isKindOfClass:NSClassFromString(@"__NSCFBoolean")]) {
            [strM appendFormat:@"\n@property (nonatomic, assign) BOOL %@;\n", key];
        } else if ([obj isKindOfClass:[NSNumber class]]) {
            [strM appendFormat:@"\n@property (nonatomic, assign) NSInteger %@;\n", key];
        } else if ([obj isKindOfClass:[NSDictionary class]]) {
            [strM appendFormat:@"\n@property (nonatomic, strong) NSDictionary *%@;\n", key];
        } else if ([obj isKindOfClass:[NSArray class]]) {
            [strM appendFormat:@"\n@property (nonatomic, strong) NSArray *%@;\n", key];
        }
    }];
    
    NSLog(@"%@", strM);
    
}

@end
